﻿// -----------------------------------------------------------------------
// <copyright file="BoardDisplay.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Exc2
{   
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public static class UIBoardDisplay
    {
        public static void PrintGameBoard(GameBoard i_gameBoard)
        {
            Ex02.ConsoleUtils.Screen.Clear();
            int sizeOfGameBoard = i_gameBoard.Size;
            char currentLetter = 'A';
            StringBuilder GameboardToPrint = new StringBuilder();

            string LineSeperatorChar = " ";
            for (int i = 0; i < sizeOfGameBoard; ++i)
            {
                LineSeperatorChar += "====";
            }

            LineSeperatorChar += '=';
            GameboardToPrint.Append("   ");
            for(int i = 0; i < sizeOfGameBoard; ++i)
            {
                GameboardToPrint.Append(currentLetter);
                currentLetter++;
                GameboardToPrint.Append("   ");
            }

            GameboardToPrint.Append(System.Environment.NewLine);
            GameboardToPrint.Append(LineSeperatorChar);
            GameboardToPrint.Append(System.Environment.NewLine);
            currentLetter = 'a';

            for (int i = 0; i < sizeOfGameBoard; i++)
            {
                GameboardToPrint.Append(currentLetter++);
                for (int j = 0; j < sizeOfGameBoard; j++)
                {
                    GameboardToPrint.Append("| ");
                    GameboardToPrint.Append(i_gameBoard.GetCheckerCell(j, i).PawnSymbol);
                    GameboardToPrint.Append(" ");
                }

                GameboardToPrint.Append("|" + Environment.NewLine);
                GameboardToPrint.Append(LineSeperatorChar);
                GameboardToPrint.Append(System.Environment.NewLine);
            }

            Console.WriteLine(GameboardToPrint);
        }
    }
}
